package com.cheng.example.util.study.hutool;

import cn.hutool.core.util.IdcardUtil;

public class IdcardUtilTest {

    public static void main(String[] args) {
        String ID_18 = "412728199107100872";
        String ID_15 = "150102880730303";

        //是否有效
        boolean valid = IdcardUtil.isValidCard(ID_18);
        boolean valid15 = IdcardUtil.isValidCard(ID_15);

        //是否有效
        System.out.println(valid);
        //年龄
        System.out.println(IdcardUtil.getAgeByIdCard(ID_18));
        //出生年
        System.out.println(IdcardUtil.getYearByIdCard (ID_18));
        //出生月
        System.out.println(IdcardUtil.getMonthByIdCard (ID_18));
        //出生日期
        System.out.println(IdcardUtil.getDayByIdCard(ID_18));
        //获取性别
        System.out.println(IdcardUtil.getGenderByIdCard(ID_18));
        //获取省份
        System.out.println(IdcardUtil.getProvinceByIdCard(ID_18));

    }
}
